//#include<stdio.h>
//
//void* my_memcpy(void* arr2, void* arr1,size_t num)
//{
//	void* ret = arr2;
//	while (num--)
//	{
//		*(char*)arr2 = *(char*)arr1;
//		arr2 = (char*)arr2 + 1;
//		arr1 = (char*)arr1 + 1;
//	}
//	return ret;
//}
//
//
//int main()
//{
//	int arr1[] = { 1,2,3,4,5,6 };
//	int arr2[10]={0};
//
//	my_memcpy(arr2, arr1, 20);
//
//	for (int i = 0; i <10 ; i++)
//	{
//		printf("%d ", arr2[i]);
//	}
//
//	return 0;
//}

#include<stdio.h>

void* my_memmove(void* arr1, void* arr2, size_t num)
{
	void* ret = arr1;
	if (arr1 > arr2)
	{
		while (num--)
		{
			*(char*)arr2 = *(char*)arr1;
			arr2 = (char*)arr2 + 1;
			arr1 = (char*)arr1 + 1;
		}
	}
	else
		while (num--)
		{
			*((char*)arr2+num) = *((char*)arr1+num);
		}
	return ret;
}

int main()
{
	int arr1[10] = { 1,2,3,4,5,6,7,8,9,10 };

	my_memmove(arr1+1, arr1, 20);

	for (int i = 0; i < 10; i++)
	{
		printf("%d ", arr1[i]);
	}

	return 0;
}